import { defineStore } from 'pinia'
import { ref } from 'vue'

export const useCounterStore = defineStore('counter', {
  state: () => ({
    count: 0,
	name: ref('小米')
  }),
  actions: {
	// actions 关于 state 的操作 
    increment() {
      this.count++
    },
    decrement() {
      this.count--
    },
  },
  getters: {
	  // getters 是对 state 的计算属性
    doubleCount: (state) => state.count * 2,
  },
})